<!DOCTYPE html>
<html manifest="http://aleonlinespot.altervista.org/manifest.php">
    <head>
        <meta charset="utf-8" />
        <title>MyPhotoMemories</title>

        <link rel="icon" href="img/favicons/icon32.png">
        <link rel="shortcut icon" href="img/favicons/icon32.png">
        <link rel="apple-touch-icon" href="img/favicons/icon57.png" sizes="57x57">
        <link rel="apple-touch-icon" href="img/favicons/icon114.png" sizes="114x114">
        <link rel="apple-touch-icon" href="img/favicons/icon72.png" sizes="72x72">
        <link rel="apple-touch-icon" sizes="80x80" href="img/favicons/icon80.png">
        <link rel="apple-touch-icon-precomposed" sizes="android-only" href="img/favicons/icon57.png">

        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0;">
        <meta name="apple-mobile-web-app-capable" content="yes">

        <!-- jQuery mobile -->      
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
        <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
        <script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>   
        <!-- jQuery url plugin -->
        <script type="text/javascript" src="../jQuery/jquery.url.js"></script>
        <!-- Gmaps for reverse geocoding -->
        <script type="text/javascript"
                src="http://maps.googleapis.com/maps/api/js?key=AIzaSyA8vPFux0WblXQfMbOpgEbDKWCGh0cEt58&sensor=true">
        </script>
        <!-- model -->
        <script src="../model/photo.js"></script>
        <script src="../model/album.js"></script>
        <!-- view -->
        <script type="text/javascript" src="draw.js"></script>
        <script type="text/javascript" src="effects.js"></script>
        <!-- controller -->
        <script src="../controller/dbController.js"></script>
        <script src="../controller/fileController.js"></script>
        <script src="../controller/locationController.js"></script>
        <script src="../controller/cacheController.js"></script>
        <script src="../controller/supportController.js"></script>
        <!-- init script -->
        <script src="initViews.js"></script>


        <!-- css -->
        <link rel="stylesheet" href="css/myStyle.css" />
        <link rel="stylesheet" href="css/graphics.css" />

    </head>
    <body>
        <div data-role="page" id="photoView">

            <!-- init script -->
            <script>
                var p;
                var PVinitW, PVinitH;
                
                $("#photoView").bind('pagebeforeshow', function(){
                    console.log("photoView pagebeforeshow");
                    
                    var albumId = sessionStorage.aid;
                    var photoId = sessionStorage.pid;
                    p = dbCon.getPhotoFromId(photoId);
                    
                    if (p != null){
                        var album = dbCon.getAlbumFromId(p.album);
 
                        $("#PVtitle").html(p.name);
                        $("#PVcaption").html(p.caption);
                        if (p.contacts != null && !p.contacts=="")
                            $("#PVcontacts").html("With "+p.contacts);
                        $("#PValbum").html("Album: "+album.name);
                        if (p.location != null && !p.location=="")
                            $("#PVlocation").html("Location: "+p.location);
                    }

                });
                
                $("#photoView").bind('pageshow', function(){
                    $.mobile.showPageLoadingMsg("a", "Loading image...");
                    var ts = cCon.getTimestamp(p.id);
                    var img = document.getElementById("PVphoto");
                    img.onload=function(){
                        PVinitW = this.width;
                        PVinitH = this.height;
                        layoutPV();
                        $.mobile.hidePageLoadingMsg();
                    }
                    $("#PVphoto").attr("src", p.path+ts);
                    
                });

            </script>

            <div data-role="header"  data-fullscreen="true" data-position ="fixed">
                <div class="logo">
                    <img src="img/logo/logo.png" alt="MyPhotoMemories"/>
                    <div class="rightHeader">
                        <a href="index.html"  data-role="button" data-icon="home"  data-iconpos="notext"></a>
                        <!-- menu -->
                        <a id="PVmenuButton" href="dialog/PVpopupMenu.html" data-rel="dialog" data-role="button" data-icon="arrow-d"  data-iconpos="notext"></a>
                        <!-- *** -->
                    </div>
                </div> 
            </div>
            <div data-role="content" id="PVphotoParent">
                <img id="PVphoto" class="fullscreen" /> 
            </div>
            <!-- overlay details -->
            <div id="overlay" data-role="footer" data-theme="a" data-fullscreen="true" data-position ="fixed">
                <h2 id="PVtitle"></h2>
                <h3 id="PVcaption"></h3>
                <p id="PVcontacts">No contacts tagged in this photo</p>
                <p id="PValbum"></p>
                <p id="PVlocation">Location unknown</p>
            </div>
        </div>
        <!-- *************** --> 



    </body>
</html>
